<?php
// +----------------------------------------------------------------------
// | Copyright (c) 2016－03－21 http://www.cencn.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 林群伟  <56583965@qq.com> <http://www.xzqly.com>
// +----------------------------------------------------------------------
namespace Common\Model;
use Think\Model;
/**
 * 权限规则模型
 * @author 林群伟 
 */
class AuthRuleModel extends Model{
    
    const RULE_URL = 1;
    const RULE_MAIN = 2;
    
    /**
     * 获取权限列表
     */
    public function getAuthRuleList($map,$order='name',$field='*'){
       return $this->field($field)->where($map)->order($order)->select();
    }
    /**
     * 获取列表 name－>id
     */
    public function getAuthRuleFiled($map,$field='*'){
         return $this->where($map)->getField($field);
    }
    /**
     * 编辑
     */
    public function saveData($map,$data){
        return $this->where($map)->save($data);
    }
    /**
     * 添加
     */
    public function addData($data){
        return $this->add($data);
    }
    /**
     * 添加所有
     */
    public function addDataAll($data){
       return $this->addAll($data);
    }

}
